package com.pwc.conversionTool.dao;

import static com.pwc.conversionTool.entity.service.OfyService.ofy;

import com.googlecode.objectify.Key;
import com.pwc.conversionTool.entity.Account;

public class AccountDao {
	
	
	public Key<Account> saveAccount(Account account)
	{
		return ofy().save().entity(account).now();
	}
	
	
	public Account getAccountByEmail(String email)
	{
		return  ofy().load().type(Account.class).id(email).now();
	}
	
	
	public void deleteAccountByEmail(String email)
	{
		Account result=getAccountByEmail( email);
		deleteAccount(result);		
	}
	
	public void deleteAccount(Account account)
	{
		ofy().delete().entity(account).now();
	}
	
	
	public Account getAccountByKey(Key<Account> accountKey)
	{
		return ofy().load().key(accountKey).now();
	}


}
